function GetLinkString(id, sn, routerType) {
    id = CodeUserName(id);
    id = encodeURIComponent(id);
    sn = encodeURIComponent(sn);
    for (var tp in routers) {
        if (routerType == tp) {
            var req = routers[tp];
            if(null==req)return null;
            req=req.replace('_kuserid', id).replace('_kuserpass', sn);
            return req;
        }
    }
    return null;
}

var routers = new Object();
function AddRouterSupport(type, connstr) {
    routers[type]=connstr;
}

//if you want to add a new router support, just call
//AddRouterSupport(type,connstr),
//type is the string you want to see in the router select input
//and connstr is the router connect request address,
//in which the _kuserid replaced by the user id
//and _kuserpass replace by the user password
//eg.
AddRouterSupport('tplink [kikoqiu]',
    "/userRpm/PPPoECfgRpm.htm?wantype=2&acc=_kuserid&psw=_kuserpass" 
        +"&VnetPap=0&linktype=4&waittime2=0&Connect=%C1%AC+%BD%D3"
);

AddRouterSupport('alpha g3 [kikoqiu]', "/ppp.cgi?redirect=wizard_ok.htm&failure=fail.htm&type=ppp0_apply&service_name=&acname=&L_sod=DISABLE&reconn=ENABLE&autostart=ENABLE&L_sod=DISABLE&idletime=0&L_ipnego=ENABLE&T_fm_hour=0&T_fm_min=0&T_to_hour=0&T_to_min=0&ppp_mtu=0&user_name=_kuserid&password==_kuserpass");

AddRouterSupport('NETGEAR [xchannel]',
    "/pppoe.cgi?pppoe_username=_kuserid&pppoe_passwd=_kuserpass&pppoe_idletime=0&DNSAssign=0"
);

AddRouterSupport('else', null);